﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <link href="~/Content/css/public.css" rel="stylesheet" />
</head>
<body class="childrenBody">
    <form class="layui-form layui-row changePwd">
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">旧密码</label>
                <div class="layui-input-block">
                    <input type="password" value="" id="oldPW" placeholder="请输入旧密码" lay-verify="required" class="layui-input pwd">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-block">
                    <input type="password" value="" id="newPW" placeholder="请输入新密码" lay-verify="required" class="layui-input pwd">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-block">
                    <input type="password" value="" id="secPW" placeholder="请确认密码" lay-verify="required" class="layui-input pwd">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" type="button" lay-filter="*" lay-submit>立即修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>
    </form>
    <script src="~/Content/layui/layui.js"></script>
    <script>
        layui.use(['layer', 'form'], function () {
            var layer = layui.layer,
                $ = layui.jquery,
                form = layui.form;
            form.on('submit(*)', function (data) {
                var param = {
                    NewPW: $("#newPW").val(),
                    OldPW: $("#oldPW").val(),
                    SecPW: $("#secPW").val()
                };
                $.ajax({
                    type: "post",
                    url: "/Admin/AdminUserInfo/UpdatePW",
                    data: data.field,
                    dataType: "json",
                    success: function (res) {
                        if (res.code == 0) {
                            layer.msg(res.msg, { icon: 1 });
                            window.location.href = '/Admin/AdminHome/Index';
                        }
                        else {
                            layer.msg(res.msg, { icon: 2 });
                        }
                    }
                });
            });
        });
    </script>
</body>
</html>
